/**
 * http://usejsdoc.org/
 */
var crypto = require('crypto');

module.exports = function(){
	this.encode = function(){
		var algorithmn = arguments[0] ? arguments[0] : null,//算法类型 sha1、md5、sha256、sha512
			enstring = 	arguments[1] ? arguments[1] : null,	//加密的字符串或者二进制数据流
			returnType = arguments[2] ? arguments[2] : null;//输出返回类型
		var hash = crypto.createHash(algorithmn);
		hash.update(enstring);
		
		return hash.digest(returnType);
	};
	
	this.decode = function(){
		console.log('it has not decode function');
	};
};